import { FormSchema, BasicColumn } from "/@/components/Table"
import { isRoleExist, listMenuScheme } from "./api"
import { DescItem } from "/@/components/Description/index"
import { render } from "/@/utils/common/renderUtils"

export const columns: BasicColumn[] = [
  {
    title: "名称",
    dataIndex: "name",
    width: 120,
  },
  {
    title: "微信号",
    dataIndex: "account",
    width: 120,
  },
  {
    title: "公众号AppId",
    dataIndex: "wxAppId",
    width: 100,
  },

  {
    title: "创建时间",
    dataIndex: "createdAt",
    width: 100,
  },
  {
    title: "创建者",
    dataIndex: "createdBy",
    width: 100,
  },

  {
    title: "二维码",
    dataIndex: "qrCodeUrl",
    slots: { customRender: "qrCodeUrl" },
    width: 70,
  },
]

export const searchFormSchema: FormSchema[] = [
  {
    field: "name",
    label: "名称",
    component: "Input",
    colProps: { span: 6 },
  },
]

export const formSchema: FormSchema[] = [
  {
    field: "id",
    label: "",
    component: "Input",
    show: false,
  },
  {
    field: "name",
    label: "名称",
    required: true,
    component: "Input",
  },
  {
    field: "account",
    label: "微信号",
    required: true,
    component: "Input",
  },
  {
    field: "wxAppId",
    label: "AppId",
    required: true,
    component: "Input",
  },
  {
    field: "wxAppSecret",
    label: "Appsecret",
    required: true,
    component: "Input",
  },
  {
    field: "token",
    label: "token",
    required: true,
    component: "Input",
  },
  {
    field: "aesKey",
    label: "加密密钥",
    required: false,
    component: "Input",
  },

  {
    label: "备注",
    field: "remark",
    component: "InputTextArea",
    componentProps: {
      placeholder: "请输入备注",
      rows: 5,
    },
  },
]

export const formDetailSchema: DescItem[] = [
  {
    field: "name",
    label: "名称",
  },
  {
    field: "account",
    label: "微信号",
  },
  {
    field: "wxAppId",
    label: "AppId",
  },
  {
    field: "wxAppSecret",
    label: "密钥",
  },
  {
    field: "url",
    label: "地址",
  },

  {
    field: "token",
    label: "token",
  },

  {
    field: "aesKey",
    label: "加密密钥",
  },

  {
    field: "qrCodeUrl",
    label: "二维码",
  },

  {
    field: "createdBy",
    label: "创建者",
  },

  {
    field: "createdAt",
    label: "创建时间",
  },

  {
    field: "updatedBy",
    label: "更新者",
  },

  {
    field: "updatedAt",
    label: "更新时间",
  },

  {
    label: "备注",
    labelMinWidth: 60,
    field: "remark",
  },
]
